package com.gusl.uploadapi.handler;

import java.io.IOException;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import com.gusl.uploadapi.exception.CommonException;
import com.gusl.uploadapi.exception.CommonIOException;
import com.gusl.uploadapi.vo.ErrorResult;

/**   
*    
* Project：uploadapi   
* Class name：AdviceHandler   
* Class Description：   
* Author：gus   
* Create Time：2020年2月13日 下午10:25:12   
* @version        
*/

@ControllerAdvice
public class AdviceHandler
{
	@ExceptionHandler({ Exception.class })
	public ErrorResult processException(CommonException exception)
	{
		return new ErrorResult(-1,exception.getMessage());
	}
	
	@ExceptionHandler({ IOException.class })
	public ErrorResult processException(CommonIOException exception)
	{
		return new ErrorResult(-2,exception.getMessage());
	}
}
